<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  install
 */

class m_install_actions_InstallPagizerAction extends f_core_Action
{
	public function execute()
	{
        $formValues = $this->getFormValues('form');

        if(isset($formValues['submit']))
        {
            if(isset($formValues['check']))
            {
                f_core_Controller::getInstance()->redirect(URL_RELATIVE.'/bo/install/Requirements');
            }
            else
            {
                $this->addToModel('error', true);
            }
        }

        $this->setView('input');
	}

	public function validate()
	{
        $mods = apache_get_modules();
        return (in_array('mod_php5', $mods) && in_array('mod_rewrite', $mods));
	}

	public function errorHandler()
	{
		$this->setView('error');
	}
}